<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script type="application/javascript" src="https://cdn.staticfile.org/moment.js/2.21.0/moment.min.js"></script>
  <title>测试</title>
  <style lang="css">
    .container {
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      width: 500px;
      height: 200px;
      background: yellow;
    }

    .item {
      width: 300px;
      height: 100px;
      background: blue;
      overflow: hidden;
    }
  </style>
</head>

<body>
  <div class="container">
    <div class="item">
      aaaaaadsadsadsada
    </div>
  </div>
  <script>
    var arr = [1, [2, [3, '4']]];
    function flatten(arr) {
        while (arr.some(item=>Array.isArray(item))) 
        {
          arr = [].concat(...arr)
        }
      return arr 
    }

    console.log(flatten(arr))
  </script>
</body>

</html>